//
//  UIView-Extension.swift
//  Browser
//
//  Created by 刘光华 on 16/4/28.
//  Copyright © 2016年 liuguanghua. All rights reserved.
//

import UIKit
import Masonry
extension UIView {
    
    /// 根据frame设置约束
    func gh_addConstraintsWithFrame(frame: CGRect) {
        
        self.mas_makeConstraints { (make: MASConstraintMaker!) -> Void in
            make.left.offset()(frame.origin.x)
            make.top.offset()(frame.origin.y)
            make.width.equalTo()(frame.size.width)
            make.height.equalTo()(frame.size.height)
        }
        
    }
    
    
    /// 重新设置约束
    func gh_remakeConstraintsWithFrame(frame: CGRect) {
        
        self.mas_remakeConstraints { (make: MASConstraintMaker!) -> Void in
            make.left.offset()(frame.origin.x)
            make.top.offset()(frame.origin.y)
            make.width.equalTo()(frame.size.width)
            make.height.equalTo()(frame.size.height)
        }
        
    }
}

